/*
 *	ApOS (Another Project software for s3c2410)
 *	
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License version 2 as
 *	published by the Free Software Foundation.
 *			
 *
 */
#ifndef _S3C2410_H
#define _S3C2410_H
// watchdog register
#define	rWTCON		(*(volatile unsigned int *)0x53000000)
#define rWTDAT 		(*(volatile unsigned int *)0x53000004)
#define rWTCNT 		(*(volatile unsigned int *)0x53000008)
//interrupt register
#define	rSRCPND		(*(volatile unsigned int *)0x4A000000)
#define	rSUBSRCPND	(*(volatile unsigned int *)0x4A000018)
#define	rINTMOD		(*(volatile unsigned int *)0x4A000004)
#define	rINTMSK		(*(volatile unsigned int *)0x4A000008)
#define	rINTSUBMSK	(*(volatile unsigned int *)0x4A00001C)
#define	rPRIORITY	(*(volatile unsigned int *)0x4A00000C)
#define	rINTPND		(*(volatile unsigned int *)0x4A000010)
#define	rINTOFFSET	(*(volatile unsigned int *)0x4A000014)
// bank ctrl register
#define	rBWSCON 	(*(volatile unsigned int *)0x48000000)
#define	rBANKCON0 	(*(volatile unsigned int *)0x48000004)
#define	rBANKCON1 	(*(volatile unsigned int *)0x48000008)
#define	rBANKCON2 	(*(volatile unsigned int *)0x4800000C)
#define	rBANKCON3 	(*(volatile unsigned int *)0x48000010)
#define	rBANKCON4 	(*(volatile unsigned int *)0x48000014)
#define	rBANKCON5 	(*(volatile unsigned int *)0x48000018)
#define	rBANKCON6	(*(volatile unsigned int *)0x4800001C)
#define	rBANKCON7 	(*(volatile unsigned int *)0x48000020)
#define	rREFRESH	(*(volatile unsigned int *)0x48000024)
#define	BANKSIZE	(*(volatile unsigned int *)0x48000028)
#define	MRSRB6		(*(volatile unsigned int *)0x4800002C)
#define	MRSRB7		(*(volatile unsigned int *)0x48000030)
// NAND flash register
#define rNFCONF		(*(volatile unsigned int *)0x4e000000)	//NAND Flash configuration
#define rNFCMD		(*(volatile unsigned char *)0x4e000004)	//NADD Flash command
#define rNFADDR		(*(volatile unsigned char *)0x4e000008)	//NAND Flash address
#define rNFDATA		(*(volatile unsigned char *)0x4e00000c)	//NAND Flash data
#define rNFSTAT		(*(volatile unsigned int *)0x4e000010)	//NAND Flash operation status
#define rNFECC		(*(volatile unsigned int *)0x4e000014)	//NAND Flash ECC
#define rNFECC0		(*(volatile unsigned char *)0x4e000014)
#define rNFECC1		(*(volatile unsigned char *)0x4e000015)
#define rNFECC2		(*(volatile unsigned char *)0x4e000016)

// I/O PORT register
#define rGPACON		(*(volatile unsigned int *)0x56000000) //Port A control
#define rGPADAT		(*(volatile unsigned int *)0x56000004) //Port A data
#define rGPBCON 	(*(volatile unsigned int *)0x56000010) //Port B control
#define rGPBDAT 	(*(volatile unsigned int *)0x56000014) //Port B data
#define rGPBUP 	 	(*(volatile unsigned int *)0x56000018) //Pull-up control B
#define rGPCCON		(*(volatile unsigned int *)0x56000020) //Port C control
#define rGPCDAT		(*(volatile unsigned int *)0x56000024) //Port C data
#define rGPCUP		(*(volatile unsigned int *)0x56000028) //Pull-up control C
#define rGPDCON		(*(volatile unsigned int *)0x56000030) //Port D control
#define rGPDDAT		(*(volatile unsigned int *)0x56000034) //Port D data
#define rGPDUP		(*(volatile unsigned int *)0x56000038) //Pull-up control D
#define rGPECON		(*(volatile unsigned int *)0x56000040) //Port E control
#define rGPEDAT		(*(volatile unsigned int *)0x56000044) //Port E data
#define rGPEUP		(*(volatile unsigned int *)0x56000048) //Pull-up control E
#define rGPFCON		(*(volatile unsigned int *)0x56000050) //Port F control
#define rGPFDAT		(*(volatile unsigned int *)0x56000054) //Port F data
#define rGPFUP		(*(volatile unsigned int *)0x56000058) //Pull-up control F
#define rGPGCON		(*(volatile unsigned int *)0x56000060) //Port G control
#define rGPGDAT		(*(volatile unsigned int *)0x56000064) //Port G data
#define rGPGUP		(*(volatile unsigned int *)0x56000068) //Pull-up control G
#define rGPHCON		(*(volatile unsigned int *)0x56000070) //Port H control
#define rGPHDAT		(*(volatile unsigned int *)0x56000074) //Port H data
#define rGPHUP		(*(volatile unsigned int *)0x56000078) //Pull-up control H 

#define rMISCCR		(*(volatile unsigned int *)0x56000080)
#define rDCLKCON	(*(volatile unsigned int *)0x56000084)
#define rEXTINT0	(*(volatile unsigned int *)0x56000088)
#define rEXTINT1	(*(volatile unsigned int *)0x5600008C)
#define rEXTINT2	(*(volatile unsigned int *)0x56000090)
#define rEINTFLT0	(*(volatile unsigned int *)0x56000094)
#define rEINTFLT1	(*(volatile unsigned int *)0x56000098)
#define rEINTFLT2	(*(volatile unsigned int *)0x5600009C)
#define rEINTFLT3	(*(volatile unsigned int *)0x4C6000A0)
#define rEINTMASK	(*(volatile unsigned int *)0x560000A4)
#define rEINTPEND	(*(volatile unsigned int *)0x560000A8)
#define rGSTATUS0	(*(volatile unsigned int *)0x560000AC)
#define rGSTATUS1	(*(volatile unsigned int *)0x560000B0)
#define rGSTATUS2	(*(volatile unsigned int *)0x560000B4)
#define rGSTATUS3	(*(volatile unsigned int *)0x560000B8)
#define rGSTATUS4	(*(volatile unsigned int *)0x560000BC)

//UART register
#define rULCON0		(*(volatile unsigned int *)0x50000000)	//UART 0 Line control
#define rUCON0		(*(volatile unsigned int *)0x50000004)	//UART 0 Control
#define rUFCON0		(*(volatile unsigned int *)0x50000008)	//UART 0 FIFO control
#define rUMCON0		(*(volatile unsigned int *)0x5000000C)	//UART 0 Modem control
#define rUTRSTAT0 	(*(volatile unsigned int *)0x50000010)	//UART 0 Tx/Rx status
#define rUERSTAT0	(*(volatile unsigned int *)0x50000014)	//UART 0 Rx error status
#define rUFSTAT0 	(*(volatile unsigned int *)0x50000018)	//UART 0 FIFO status
#define rUMSTAT0	(*(volatile unsigned int *)0x5000001C)	//UART 0 Modem status
#define rUBRDIV0	(*(volatile unsigned int *)0x50000028)	//UART 0 Baud rate divisor
#define rUTXH0		(*(volatile unsigned char *)0x50000020)	//UART 0 Transmission Hold
#define rURXH0		(*(volatile unsigned char *)0x50000024)	//UART 0 Receive buffer
#define WrUTXH0(ch)	(*(volatile unsigned char *)0x50000020)=(unsigned char)(ch)
#define RdURXH0()	(*(volatile unsigned char *)0x50000024)


// CLOCK & POWER MANAGEMENT
#define rLOCKTIME   	(*(volatile unsigned int *)0x4c000000) //PLL lock time counter
#define rMPLLCON    	(*(volatile unsigned int *)0x4c000004) //MPLL Control
#define rUPLLCON    	(*(volatile unsigned int *)0x4c000008) //UPLL Control
#define rCLKCON     	(*(volatile unsigned int *)0x4c00000c) //Clock generator control
#define rCLKSLOW    	(*(volatile unsigned int *)0x4c000010) //Slow clock control
#define rCLKDIVN    	(*(volatile unsigned int *)0x4c000014) //Clock divider control

// LCD register
#define rLCDCON1	(*(volatile unsigned int *)0x4D000000)
#define rLCDCON2	(*(volatile unsigned int *)0x4D000004)
#define rLCDCON3	(*(volatile unsigned int *)0x4D000008)
#define rLCDCON4	(*(volatile unsigned int *)0x4D00000c)
#define rLCDCON5	(*(volatile unsigned int *)0x4D000010)
#define rLCDSADDR1	(*(volatile unsigned int *)0x4D000014)
#define rLCDSADDR2	(*(volatile unsigned int *)0x4D000018)
#define rLCDSADDR3	(*(volatile unsigned int *)0x4D00001c)
#define rREDLUT 	(*(volatile unsigned int *)0x4D000020)
#define rGREENLUT	(*(volatile unsigned int *)0x4D000024)
#define rBLUELUT 	(*(volatile unsigned int *)0x4D000028)
#define rDITHMODE	(*(volatile unsigned int *)0x4D00004c)
#define rTPAL 		(*(volatile unsigned int *)0x4D000050)
#define rLCDINTPND 	(*(volatile unsigned int *)0x4D000054)
#define rLCDSRCPND 	(*(volatile unsigned int *)0x4D000058)
#define rLCDINTMSK	(*(volatile unsigned int *)0x4D00005c)
#define rLPCSEL 	(*(volatile unsigned int *)0x4D000060)

// Timer register
#define rTCFG0		(*(volatile unsigned int *)0x51000000)
#define rTCFG1		(*(volatile unsigned int *)0x51000004)
#define rTCON		(*(volatile unsigned int *)0x51000008)
#define rTCNTB0 	(*(volatile unsigned int *)0x5100000C)
#define rTCMPB0 	(*(volatile unsigned int *)0x51000010)
#define rTCNTO0 	(*(volatile unsigned int *)0x51000014)
#define rTCNTB1 	(*(volatile unsigned int *)0x51000018)
#define rTCMPB1 	(*(volatile unsigned int *)0x5100001C)
#define rTCNTO1 	(*(volatile unsigned int *)0x51000020)
#define rTCNTB2 	(*(volatile unsigned int *)0x51000024)
#define rTCMPB2 	(*(volatile unsigned int *)0x51000028)
#define rTCNTO2 	(*(volatile unsigned int *)0x5100002C)
#define rTCNTB3 	(*(volatile unsigned int *)0x51000030)
#define rTCMPB3 	(*(volatile unsigned int *)0x51000034)
#define rTCNTO3 	(*(volatile unsigned int *)0x51000038)
#define rTCNTB4 	(*(volatile unsigned int *)0x5100003C)
#define rTCNTO4 	(*(volatile unsigned int *)0x51000040)

//ADC register
#define rADCCON 	(*(volatile unsigned int *)0x58000000)
#define rADCTSC 	(*(volatile unsigned int *)0x58000004)
#define rADCDLY 	(*(volatile unsigned int *)0x58000008)
#define rADCDAT0 	(*(volatile unsigned int *)0x5800000C)
#define rADCDAT1 	(*(volatile unsigned int *)0x58000010)

//DMA register
#define rDISRC0 	(*(volatile unsigned int *)0x4B000000)
#define rDISRC1 	(*(volatile unsigned int *)0x4B000040)
#define rDISRC2 	(*(volatile unsigned int *)0x4B000080)
#define rDISRC3 	(*(volatile unsigned int *)0x4B0000C0)
#define rDISRCC0 	(*(volatile unsigned int *)0x4B000004)
#define rDISRCC1 	(*(volatile unsigned int *)0x4B000044)
#define rDISRCC2 	(*(volatile unsigned int *)0x4B000084)
#define rDISRCC3 	(*(volatile unsigned int *)0x4B0000C4)
#define rDIDST0 	(*(volatile unsigned int *)0x4B000008)
#define rDIDST1 	(*(volatile unsigned int *)0x4B000048)
#define rDIDST2 	(*(volatile unsigned int *)0x4B000088)
#define rDIDST3 	(*(volatile unsigned int *)0x4B0000C8)
#define rDIDSTC0 	(*(volatile unsigned int *)0x4B00000C)
#define rDIDSTC1 	(*(volatile unsigned int *)0x4B00004C)
#define rDIDSTC2 	(*(volatile unsigned int *)0x4B00008C)
#define rDIDSTC3 	(*(volatile unsigned int *)0x4B0000CC)
#define rDCON0		(*(volatile unsigned int *)0x4B000010)
#define rDCON1		(*(volatile unsigned int *)0x4B000050)
#define rDCON2		(*(volatile unsigned int *)0x4B000090)
#define rDCON3		(*(volatile unsigned int *)0x4B0000D0)
#define rDSTAT0		(*(volatile unsigned int *)0x4B000014)
#define rDSTAT1		(*(volatile unsigned int *)0x4B000054)
#define rDSTAT2		(*(volatile unsigned int *)0x4B000094)
#define rDSTAT3		(*(volatile unsigned int *)0x4B0000D4)
#define rDCSRC0		(*(volatile unsigned int *)0x4B000018)
#define rDCSRC1		(*(volatile unsigned int *)0x4B000058)
#define rDCSRC2		(*(volatile unsigned int *)0x4B000098)
#define rDCSRC3		(*(volatile unsigned int *)0x4B0000D8)
#define rDCDST0		(*(volatile unsigned int *)0x4B00001C)
#define rDCDST1		(*(volatile unsigned int *)0x4B00005C)
#define rDCDST2		(*(volatile unsigned int *)0x4B00009C)
#define rDCDST3		(*(volatile unsigned int *)0x4B0000DC)
#define rDMASKTRIG0	(*(volatile unsigned int *)0x4B000020)
#define rDMASKTRIG1	(*(volatile unsigned int *)0x4B000060)
#define rDMASKTRIG2	(*(volatile unsigned int *)0x4B0000A0)
#define rDMASKTRIG3	(*(volatile unsigned int *)0x4B0000E0)

//sdi register
#define rSDICON		(*(volatile unsigned int *)0x5A000000)
#define rSDIPRE		(*(volatile unsigned int *)0x5A000004)
#define rSDICARG	(*(volatile unsigned int *)0x5A000008)
#define rSDICCON	(*(volatile unsigned int *)0x5A00000C)
#define rSDICSTA	(*(volatile unsigned int *)0x5A000010)
#define rSDIRSP0	(*(volatile unsigned int *)0x5A000014)
#define rSDIRSP1	(*(volatile unsigned int *)0x5A000018)
#define rSDIRSP2	(*(volatile unsigned int *)0x5A00001C)
#define rSDIRSP3	(*(volatile unsigned int *)0x5A000020)
#define rSDIDTIMER	(*(volatile unsigned int *)0x5A000024)
#define rSDIBSIZE	(*(volatile unsigned int *)0x5A000028)
#define rSDIDCON	(*(volatile unsigned int *)0x5A00002C)
#define rSDIDCNT	(*(volatile unsigned int *)0x5A000030)
#define rSDIDSTA	(*(volatile unsigned int *)0x5A000034)
#define rSDIFSTA	(*(volatile unsigned int *)0x5A000038)
#define rSDIDAT		(*(volatile unsigned int *)0x5A00003C)
#define rSDIIMSK	(*(volatile unsigned int *)0x5A000040)

//iis register
#define rIISCON		(*(volatile unsigned short *)0x55000000)
#define rIISMOD		(*(volatile unsigned short *)0x55000004)
#define rIISPSR		(*(volatile unsigned short *)0x55000008)
#define rIISFCON	(*(volatile unsigned short *)0x5500000C)
#define rIISFIFO	(*(volatile unsigned short *)0x55000010)




//USB Host register
#define rHcRevision		(*(volatile unsigned int *)0x49000000)
#define rHcControl		(*(volatile unsigned int *)0x49000004)
#define rHcCommonStatus		(*(volatile unsigned int *)0x49000008)
#define rHcInterruptStatus	(*(volatile unsigned int *)0x4900000C)
#define rHcInterruptEnable	(*(volatile unsigned int *)0x49000010)
#define rHcInterruptDisable	(*(volatile unsigned int *)0x49000014)
#define rHcHCCA			(*(volatile unsigned int *)0x49000018)
#define rHcPeriodCuttentED	(*(volatile unsigned int *)0x4900001C)
#define rHcControlHeadED	(*(volatile unsigned int *)0x49000020)
#define rHcControlCurrentED	(*(volatile unsigned int *)0x49000024)
#define rHcBulkHeadED		(*(volatile unsigned int *)0x49000028)
#define rHcBulkCurrentED	(*(volatile unsigned int *)0x4900002C)
#define rHcDoneHead		(*(volatile unsigned int *)0x49000030)
#define rHcRmInterval		(*(volatile unsigned int *)0x49000034)
#define rHcFmRemaining		(*(volatile unsigned int *)0x49000038)
#define rHcFmNumber		(*(volatile unsigned int *)0x4900003C)
#define rHcPeriodicStart	(*(volatile unsigned int *)0x49000040)
#define rHcLSThreshold		(*(volatile unsigned int *)0x49000044)
#define rHcRhDescriptorA	(*(volatile unsigned int *)0x49000048)
#define rHcRhDescriptorB	(*(volatile unsigned int *)0x4900004C)
#define rHcRhStatus		(*(volatile unsigned int *)0x49000050)
#define rHcRhPortStatus1	(*(volatile unsigned int *)0x49000054)
#define rHcRhPortStatus2	(*(volatile unsigned int *)0x49000058)
//USB Device register
#define rFUNC_ADDR_REG	(*(volatile unsigned char *)0x52000140) //Function address
#define rPWR_REG	(*(volatile unsigned char *)0x52000144) //Power management
#define rEP_INT_REG	(*(volatile unsigned char *)0x52000148) //EP Interrupt pending and clear
#define rUSB_INT_REG	(*(volatile unsigned char *)0x52000158) //USB Interrupt pending and clear
#define rEP_INT_EN_REG	(*(volatile unsigned char *)0x5200015c) //Interrupt enable
#define rUSB_INT_EN_REG	(*(volatile unsigned char *)0x5200016c)
#define rFRAME_NUM1_REG	(*(volatile unsigned char *)0x52000170) //Frame number lower byte
#define rFRAME_NUM2_REG	(*(volatile unsigned char *)0x52000174) //Frame number higher byte
#define rINDEX_REG	(*(volatile unsigned char *)0x52000178) //Register index
#define rMAXP_REG	(*(volatile unsigned char *)0x52000180) //Endpoint max packet
#define rEP0_CSR	(*(volatile unsigned char *)0x52000184) //Endpoint 0 status
#define rIN_CSR1_REG	(*(volatile unsigned char *)0x52000184) //In endpoint control status
#define rIN_CSR2_REG	(*(volatile unsigned char *)0x52000188)
#define rOUT_CSR1_REG	(*(volatile unsigned char *)0x52000190) //Out endpoint control status
#define rOUT_CSR2_REG	(*(volatile unsigned char *)0x52000194)
#define rOUT_FIFO_CNT1_REG	(*(volatile unsigned char *)0x52000198) //Endpoint out write count
#define rOUT_FIFO_CNT2_REG	(*(volatile unsigned char *)0x5200019c)
#define rEP0_FIFO	(*(volatile unsigned char *)0x520001c0) //Endpoint 0 FIFO
#define rEP1_FIFO	(*(volatile unsigned char *)0x520001c4) //Endpoint 1 FIFO
#define rEP2_FIFO	(*(volatile unsigned char *)0x520001c8) //Endpoint 2 FIFO
#define rEP3_FIFO	(*(volatile unsigned char *)0x520001cc) //Endpoint 3 FIFO
#define rEP4_FIFO	(*(volatile unsigned char *)0x520001d0) //Endpoint 4 FIFO
#define rEP1_DMA_CON	(*(volatile unsigned char *)0x52000200) //EP1 DMA interface control
#define rEP1_DMA_UNIT	(*(volatile unsigned char *)0x52000204) //EP1 DMA Tx unit counter
#define rEP1_DMA_FIFO	(*(volatile unsigned char *)0x52000208) //EP1 DMA Tx FIFO counter
#define rEP1_DMA_TTC_L	(*(volatile unsigned char *)0x5200020c) //EP1 DMA total Tx counter
#define rEP1_DMA_TTC_M	(*(volatile unsigned char *)0x52000210)
#define rEP1_DMA_TTC_H	(*(volatile unsigned char *)0x52000214)
#define rEP2_DMA_CON	(*(volatile unsigned char *)0x52000218) //EP2 DMA interface control
#define rEP2_DMA_UNIT	(*(volatile unsigned char *)0x5200021c) //EP2 DMA Tx unit counter
#define rEP2_DMA_FIFO	(*(volatile unsigned char *)0x52000220) //EP2 DMA Tx FIFO counter
#define rEP2_DMA_TTC_L	(*(volatile unsigned char *)0x52000224) //EP2 DMA total Tx counter
#define rEP2_DMA_TTC_M	(*(volatile unsigned char *)0x52000228)
#define rEP2_DMA_TTC_H	(*(volatile unsigned char *)0x5200022c)
#define rEP3_DMA_CON	(*(volatile unsigned char *)0x52000240) //EP3 DMA interface control
#define rEP3_DMA_UNIT	(*(volatile unsigned char *)0x52000244) //EP3 DMA Tx unit counter
#define rEP3_DMA_FIFO	(*(volatile unsigned char *)0x52000248) //EP3 DMA Tx FIFO counter
#define rEP3_DMA_TTC_L	(*(volatile unsigned char *)0x5200024c) //EP3 DMA total Tx counter
#define rEP3_DMA_TTC_M	(*(volatile unsigned char *)0x52000250)
#define rEP3_DMA_TTC_H	(*(volatile unsigned char *)0x52000254)
#define rEP4_DMA_CON	(*(volatile unsigned char *)0x52000258) //EP4 DMA interface control
#define rEP4_DMA_UNIT	(*(volatile unsigned char *)0x5200025c) //EP4 DMA Tx unit counter
#define rEP4_DMA_FIFO	(*(volatile unsigned char *)0x52000260) //EP4 DMA Tx FIFO counter
#define rEP4_DMA_TTC_L	(*(volatile unsigned char *)0x52000264) //EP4 DMA total Tx counter
#define rEP4_DMA_TTC_M	(*(volatile unsigned char *)0x52000268)
#define rEP4_DMA_TTC_H	(*(volatile unsigned char *)0x5200026c)

#endif

